﻿using PlaceOrder_Core.PlaceOrderModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlaceOrder_Server.Comparer
{
    public class MessageComparer : IEqualityComparer<ChatMessage>
    {
        public bool Equals(ChatMessage x, ChatMessage y)
        {
            if (x == null || y == null) return false;
            return x.ChatId == y.ChatId && x.CreateTime == y.CreateTime;
        }

        public int GetHashCode(ChatMessage obj)
        {
            return obj.ChatId.GetHashCode() ^ obj.CreateTime.GetHashCode();
        }
    }

}
